package com.example.project.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.project.core.text.Convert;
import com.example.project.entity.TimeActivitie;
import com.example.project.mapper.TimeActivitieMapper;
import com.example.project.service.TimeActivitieService;
import com.example.project.utils.CacheUtils;
import com.example.project.utils.DateUtils;

/**
 * 时间活动Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-11-17
 */
@Service
public class TimeActivitieServiceImpl implements TimeActivitieService {

	@Autowired
	private TimeActivitieMapper timeActivitieMapper;

	/**
	 * 查询时间活动
	 * 
	 * @param id 时间活动主键
	 * @return 时间活动
	 */
	@Override
	public TimeActivitie selectTimeActivitieById(Long id) {
		return timeActivitieMapper.selectTimeActivitieById(id);
	}

	/**
	 * 查询时间活动列表
	 * 
	 * @param timeActivitie 时间活动
	 * @return 时间活动
	 */
	@Override
	public List<TimeActivitie> selectTimeActivitieList(TimeActivitie timeActivitie) {
		return timeActivitieMapper.selectTimeActivitieList(timeActivitie);
	}

	/**
	 * 新增时间活动
	 * 
	 * @param timeActivitie 时间活动
	 * @return 结果
	 */
	@Override
	public int insertTimeActivitie(TimeActivitie timeActivitie) {
		CacheUtils.remove("timeActivitieList");
		timeActivitie.setCreateTime(DateUtils.curLocalDateTime());
		return timeActivitieMapper.insertTimeActivitie(timeActivitie);
	}

	/**
	 * 修改时间活动
	 * 
	 * @param timeActivitie 时间活动
	 * @return 结果
	 */
	@Override
	public int updateTimeActivitie(TimeActivitie timeActivitie) {
		CacheUtils.remove("timeActivitieList");
		timeActivitie.setUpdateTime(DateUtils.curLocalDateTime());
		return timeActivitieMapper.updateTimeActivitie(timeActivitie);
	}

	/**
	 * 批量删除时间活动
	 * 
	 * @param ids 需要删除的时间活动主键
	 * @return 结果
	 */
	@Override
	public int deleteTimeActivitieByIds(String ids) {
		CacheUtils.remove("timeActivitieList");
		return timeActivitieMapper.deleteTimeActivitieByIds(Convert.toStrArray(ids));
	}

	/**
	 * 删除时间活动信息
	 * 
	 * @param id 时间活动主键
	 * @return 结果
	 */
	@Override
	public int deleteTimeActivitieById(Long id) {
		CacheUtils.remove("timeActivitieList");
		return timeActivitieMapper.deleteTimeActivitieById(id);
	}
}
